home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / IEditor / Expanders / GetFile / funcs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-17  |  35.8 KB  |  1,421 lines

  1. /// Includes
  2. #define INTUI_V36_NAMES_ONLY
  3.  
  4. #include <exec/nodes.h>                 // exec
  5. #include <exec/lists.h>
  6. #include <exec/memory.h>
  7. #include <exec/types.h>
  8. #include <dos/dos.h>                    // dos
  9. #include <dos/dostags.h>
  10. #include <intuition/intuition.h>        // intuition
  11. #include <intuition/gadgetclass.h>
  12. #include <graphics/text.h>              // graphics
  13. #include <libraries/gadtools.h>         // libraries
  14. #include <clib/exec_protos.h>           // protos
  15. #include <clib/dos_protos.h>
  16. #include <clib/intuition_protos.h>
  17. #include <pragmas/exec_pragmas.h>       // pragmas
  18. #include <pragmas/dos_pragmas.h>
  19. #include <pragmas/intuition_pragmas.h>
  20. #include <pragmas/graphics_pragmas.h>
  21. #include <pragmas/gadtools_pragmas.h>
  22.  
  23. #include <stdarg.h>
  24. #include <string.h>
  25. #include <stdio.h>
  26. #include <stdlib.h>
  27. #include <ctype.h>
  28.  
  29. #include "DEV_IE:Expanders/defs.h"
  30. #include "Edit.h"
  31. ///
  32. /// Prototypes
  33. static void     FGetString( BPTR, STRPTR );
  34. static void     PutString( BPTR, STRPTR );
  35.  
  36. struct GFInfo {
  37.         struct  Node gi_Node;
  38.         UWORD   gi_Kind;
  39.         UBYTE   gi_Flags;
  40.         UBYTE   gi_Pad;
  41.         APTR    gi_Reserved;
  42.         UBYTE   gi_Reserved2[80];
  43.         UBYTE   gi_Label[40];
  44.         WORD    gi_User1;
  45.         WORD    gi_Left;
  46.         WORD    gi_Top;
  47.         UWORD   gi_Width;
  48.         UWORD   gi_Height;
  49.         BOOL    gi_disabled;
  50. };
  51.  
  52. extern long DOSBase;
  53.  
  54. __chip USHORT GF_Imagedata[] =
  55. {
  56.    0x0000, 0x1000,
  57.    0x0000, 0x3000,
  58.    0x003C, 0x3000,
  59.    0x0042, 0x3000,
  60.    0x0F81, 0x3000,
  61.    0x0FC1, 0x3000,
  62.    0x0C3F, 0x3000,
  63.    0x0C01, 0x3000,
  64.    0x0C01, 0x3000,
  65.    0x0C01, 0x3000,
  66.    0x0FFF, 0x3000,
  67.    0x0000, 0x3000,
  68.    0x0000, 0x3000,
  69.    0x7FFF, 0xF000,
  70.  
  71.    0xFFFF, 0xE000,
  72.    0xC000, 0x0000,
  73.    0xC000, 0x0000,
  74.    0xC000, 0x0000,
  75.    0xC000, 0x0000,
  76.    0xC000, 0x0000,
  77.    0xC000, 0x0000,
  78.    0xC000, 0x0000,
  79.    0xC000, 0x0000,
  80.    0xC000, 0x0000,
  81.    0xC000, 0x0000,
  82.    0xC000, 0x0000,
  83.    0xC000, 0x0000,
  84.    0x8000, 0x0000,
  85.  
  86.    };
  87.  
  88. struct Image GetFileImage =
  89. {
  90.    0,0,                 /* X, Y */
  91.    20, 14, 2,           /* Width, Height, Depth */
  92.    &GF_Imagedata[0],        /* Image Data*/
  93.    3, 0,                /* PlanePick, PlaneOnOff */
  94.    NULL                 /* Next Image Structure*/
  95. };
  96. ///
  97.  
  98.  
  99.  
  100. /// I/O support functions
  101. void FGetString( BPTR File, STRPTR str )
  102. {
  103.     UBYTE   len;
  104.  
  105.     len = FGetC( File );
  106.  
  107.     FRead( File, str, len, 1 );
  108.  
  109.     str[ len ] = '\0';
  110.  
  111.     if(!( len & 1 ))
  112.         FGetC( File );
  113. }
  114.  
  115. void PutString( BPTR File, STRPTR str )
  116. {
  117.     UBYTE   len;
  118.  
  119.     len = strlen( str );
  120.  
  121.     FPutC( File, len );
  122.     FWrite( File, str, len, 1 );
  123.  
  124.     if(!( len & 1 ))
  125.         FPutC( File, 0 );
  126. }
  127. ///
  128.  
  129.  
  130. /*  Starting function           */
  131. /// IEX_Mount Doc
  132. /****** expander.library/IEX_Mount ******************************************
  133. *
  134. *   NAME
  135. *       IEX_Mount  -  Provide expander informations
  136. *
  137. *   SYNOPSIS
  138. *       error = IEX_Mount( IE_Data );
  139. *                            A0
  140. *
  141. *       ULONG IEX_Mount( struct IE_Data * );
  142. *
  143. *   FUNCTION
  144. *       This function is called by IEditor before first usage of the
  145. *       expander. The expander should fill its base with informations
  146. *       about its abilities and open its source description file.
  147. *
  148. *   INPUTS
  149. *       IE_Data -   information about IE
  150. *
  151. *   RESULT
  152. *       error   -   IEX_OK or an error code
  153. *
  154. *   NOTES
  155. *
  156. *   BUGS
  157. *
  158. *   SEE ALSO
  159. *       IEditor/Expander.h
  160. *
  161. *****************************************************************************
  162. *
  163. */
  164. ///
  165. /// IEX_Mount
  166. __geta4 ULONG IEX_Mount( __A0 struct IE_Data *IE )
  167. {
  168.     BPTR                    DescFile;
  169.     struct FileInfoBlock   *fib;
  170.     ULONG                   ret = IEX_ERROR_NO_DESC_FILE;
  171.     static UBYTE            FileName[] = "PROGDIR:Expanders/GetFile.desc";
  172.  
  173.     Forbid();   /* we're going to write to a GLOBAL variable */
  174.  
  175.     if( Desc ) {            /* already mounted? */
  176.         Permit();
  177.         return( IEX_OK );
  178.     }
  179.  
  180.     LibBase->Kind      = IEX_OBJECT_KIND;
  181.  
  182.     LibBase->Resizable = FALSE;
  183.     LibBase->Movable   = TRUE;
  184.     LibBase->HasItems  = FALSE;
  185.     LibBase->UseFonts  = FALSE;
  186.  
  187.     LibBase->Node.ln_Name = "GETFILE";
  188.  
  189.     if( fib = AllocDosObject( DOS_FIB, NULL )) {
  190.         if( DescFile = Lock( FileName, ACCESS_READ )) {
  191.  
  192.             Examine( DescFile, fib );
  193.             UnLock( DescFile );
  194.  
  195.             if( Desc = AllocVec( fib->fib_Size, 0L )) {
  196.                 if( DescFile = Open( FileName, MODE_OLDFILE )) {
  197.  
  198.                     Read( DescFile, Desc, fib->fib_Size );
  199.                     Close( DescFile );
  200.  
  201.                     ( *IE->IEXFun->SplitLines )( Desc ); // VERY important!
  202.  
  203.                     STRPTR pri;
  204.  
  205.                     pri = ( *IE->IEXFun->GetFirstLine )( Desc, "RENDPRI" );
  206.  
  207.                     if( pri )
  208.                         LibBase->Node.ln_Pri = atoi( pri );
  209.                     else
  210.                         LibBase->Node.ln_Pri = 0;
  211.  
  212.                     ret = IEX_OK;
  213.  
  214.                 } else {
  215.                     FreeVec( Desc );
  216.                     Desc = NULL;
  217.                 }
  218.             }
  219.  
  220.         }
  221.  
  222.         FreeDosObject( DOS_FIB, fib );
  223.     }
  224.  
  225.     Permit();
  226.  
  227.     return( ret );
  228. }
  229. ///
  230.  
  231.  
  232. /*  Edit functions              */
  233. /// IEX_Add Doc
  234. /****** expander.library/IEX_Add ********************************************
  235. *
  236. *   NAME
  237. *       IEX_Add  -  Add an object to the active window
  238. *
  239. *   SYNOPSIS
  240. *       success = IEX_Add( ID, IE_Data, x, y, width, heigth );
  241. *                          D0    A0     D1 D2  D3      D4
  242. *
  243. *       BOOL IEX_Add( UWORD, struct IE_Data *, WORD, WORD, UWORD, UWORD );
  244. *
  245. *   FUNCTION
  246. *       This function is called by IEditor when the user selects the
  247. *       name of our object from the Add Gadget list.
  248. *       If our object can be moved and resized, the user will be asked
  249. *       to draw it (like gadtools gadgets) and then IE will call this
  250. *       function with the coordinates and the size of the drawn box.
  251. *
  252. *       If your object needs a label for the source, you must provide
  253. *       it, in the case the user doesn't want to type it in.
  254. *       E.g.
  255. *                   sprintf( Obj->Label, "%sGad%03ld",
  256. *                            IE->win_info->wi_Label,
  257. *                            IE->win_info->wi_NewGadID );
  258. *                   IE.win_info->wi_NewGadID += 1;
  259. *
  260. *
  261. *       You must also update the IE->win_info->wi_NumObjects variable.
  262. *
  263. *   INPUTS
  264. *       ID          -   ID assigned by IE. You MUST put it in the o_Kind
  265. *                       field.
  266. *       IE_Data     -   information about IE
  267. *       x, y        -   top left corner of the box drawn by the user
  268. *       width, height - size of the box
  269. *
  270. *   RESULT
  271. *       success     -   TRUE for success, FALSE for failure
  272. *
  273. *   NOTES
  274. *
  275. *   BUGS
  276. *
  277. *   SEE ALSO
  278. *       IEditor/Expander.h, IEX_Remove()
  279. *
  280. *****************************************************************************
  281. *
  282. */
  283. ///
  284. /// IEX_Add
  285. __geta4 BOOL IEX_Add( __D0 UWORD ID, __A0 struct IE_Data *IE, __D1 WORD x, __D2 WORD y, __D3 UWORD width, __D4 UWORD height )
  286. {
  287.     struct GFInfo   *temp_data;
  288.     BOOL                ret = FALSE;
  289.  
  290.     if( temp_data = AllocMem( sizeof( struct GFInfo ), MEMF_CLEAR )) {
  291.  
  292.         temp_data->gi_Kind   = ID;       /* DON'T FORGET!!! */
  293.         temp_data->gi_Left   = x;
  294.         temp_data->gi_Top    = y;
  295.         temp_data->gi_Width  = 21;
  296.         temp_data->gi_Height = 14;
  297.         temp_data->gi_Flags  = G_ATTIVO; /* make it active  */
  298.  
  299.         sprintf( temp_data->gi_Label, "%sGFGad%03ld",
  300.                  IE->win_info->wi_Label,
  301.                  IE->win_info->wi_NewGadID );
  302.         IE->win_info->wi_NewGadID += 1;
  303.  
  304.         /* add our object to the list */
  305.         AddTail((struct List *)&IE->win_info->wi_Gadgets, (struct Node *)temp_data );
  306.  
  307.         IE->win_info->wi_NumObjects += 1;
  308.  
  309.         ret = TRUE;
  310.     }
  311.  
  312.     return( ret );
  313. }
  314. ///
  315. /// IEX_Remove Doc
  316. /****** expander.library/IEX_Remove *****************************************
  317. *
  318. *   NAME
  319. *       IEX_Remove  -  Remove our objects
  320. *
  321. *   SYNOPSIS
  322. *       IEX_Remove( ID, IE_Data );
  323. *                   D0     A0
  324. *
  325. *       void IEX_Remove( UWORD, struct IE_Data * );
  326. *
  327. *   FUNCTION
  328. *       IEditor calls this function when the user wants to delete
  329. *       some objects it doesn't know.
  330. *       You should then remove all the object whose o_Kind field
  331. *       is equal to the ID passed by IE  *AND*  that are selected
  332. *       (check the G_ATTIVO flag in o_flags2).
  333. *
  334. *       This function is called alse when deleting a window or
  335. *       freeing the GUI: of course, all objects will be selected.
  336. *
  337. *   INPUTS
  338. *       ID          -   your ID
  339. *       IE_Data     -   information about IE
  340. *
  341. *   RESULT
  342. *
  343. *   NOTES
  344. *       Don't forget to update the IE->win_info->wi_NumObjects variable!
  345. *
  346. *   BUGS
  347. *
  348. *   SEE ALSO
  349. *       IEditor/Expander.h, IEX_Add()
  350. *
  351. *****************************************************************************
  352. *
  353. */
  354. ///
  355. /// IEX_Remove
  356. __geta4 void IEX_Remove( __D0 UWORD ID, __A0 struct IE_Data *IE )
  357. {
  358.     struct GFInfo   *temp_data, *next;
  359.  
  360.     for( temp_data = IE->win_info->wi_Gadgets.mlh_Head; temp_data->gi_Node.ln_Succ; temp_data = temp_data->gi_Node.ln_Succ ) {
  361.         /* remove only the objects of our kind and that are selected  */
  362.         if(( temp_data->gi_Kind == ID ) && ( temp_data->gi_Flags & G_ATTIVO )) {
  363.             next = temp_data->gi_Node.ln_Pred;
  364.  
  365.             Remove(( struct Node * )temp_data );
  366.  
  367.             IE->win_info->wi_NumObjects -= 1;
  368.  
  369.             FreeMem( temp_data, sizeof( struct GFInfo ));
  370.             temp_data = next;
  371.         }
  372.     }
  373. }
  374. ///
  375. /// IEX_Edit Doc
  376. /****** expander.library/IEX_Edit *******************************************
  377. *
  378. *   NAME
  379. *       IEX_Edit  -  Edit our objects
  380. *
  381. *   SYNOPSIS
  382. *       edited = IEX_Edit( ID, IE_Data );
  383. *                          D0     A0
  384. *
  385. *       BOOL IEX_Edit( UWORD, struct IE_Data * );
  386. *
  387. *   FUNCTION
  388. *       IEditor calls this function when the user wants to edit
  389. *       some objects it doesn't know.
  390. *       You should then open your edit window on IEditor's screen
  391. *       for all objects whose o_Kind field is equal to the ID passed
  392. *       by IE  *AND*  that are selected (check the G_ATTIVO flag in
  393. *       o_flags2).
  394. *       If your expander doesn't support the edit function, it MUST
  395. *       return FALSE.
  396. *
  397. *   INPUTS
  398. *       ID          -   your ID
  399. *       IE_Data     -   information about IE
  400. *
  401. *   RESULT
  402. *       edited      -   TRUE if the user changed some object params,
  403. *                       otherwise FALSE
  404. *
  405. *   NOTES
  406. *       You can find very comfortable to generate the GUI for your
  407. *       expanders using the C_IE_Mod.generator.
  408. *
  409. *   BUGS
  410. *
  411. *   SEE ALSO
  412. *       IEditor/Expander.h
  413. *
  414. *****************************************************************************
  415. *
  416. */
  417. ///
  418. /// IEX_Edit
  419. __geta4 BOOL IEX_Edit( __D0 UWORD ID, __A0 struct IE_Data *IE )
  420. {
  421.     BOOL                ret = FALSE;
  422.     struct GFInfo      *temp_gad;
  423.     struct Window      *Wnd;
  424.     struct Gadget      *GList, *Gadgets[ Main_CNT ];
  425.  
  426.    
  427.     for( temp_gad = IE->win_info->wi_Gadgets.mlh_Head; temp_gad->gi_Node.ln_Succ; temp_gad = temp_gad->gi_Node.ln_Succ )
  428.         {
  429.         if(( temp_gad->gi_Kind == ID ) && ( temp_gad->gi_Flags & G_ATTIVO ))
  430.            {
  431.  
  432.             GList = NULL;
  433.  
  434.             if( OpenMainWindow( &Wnd, &GList, &Gadgets[0], IE ))
  435.                 {
  436.                 (*IE->Functions->Status)( "Cannot open my window!", TRUE, 0 );
  437.                 }
  438.             else
  439.                {
  440.                 ret=HandleWindow(Wnd, Gadgets[0], temp_gad,IE, );
  441.                }
  442.  
  443.             CloseWnd( &Wnd, &GList );
  444.            }
  445.         }
  446.  
  447.     return( ret );
  448. }
  449.  
  450. BOOL HandleWindow(struct Window *Wnd, struct Gadget *Gadgets[], struct GFInfo *temp_gad, struct IE_Data *IE)
  451. {
  452.      struct TagItem GTTags[] = {
  453.                           {NULL, NULL},
  454.                           {TAG_END, NULL}
  455.                           };
  456.      int rt;
  457.      BOOL rcode=FALSE;
  458.  
  459.      GTTags[0].ti_Tag=GTST_String;
  460.      GTTags[0].ti_Data=(ULONG)(temp_gad->gi_Label);
  461.  
  462.      GT_SetGadgetAttrsA( Gadgets[ GD_Label ], Wnd, NULL,>Tags[0]);
  463.  
  464.      GTTags[0].ti_Tag=GTCB_Checked;
  465.      GTTags[0].ti_Data=(ULONG)(temp_gad->gi_disabled);
  466.      GT_SetGadgetAttrsA( Gadgets[ GD_Disabled ], Wnd, NULL,>Tags[0]);
  467.  
  468.      IE->UserData = temp_gad;
  469.  
  470.      do
  471.          {
  472.          WaitPort( Wnd->UserPort );
  473.          rt = HandleMainIDCMP( Wnd, &Gadgets[0], IE );
  474.          }
  475.      while( rt == 0 );
  476.  
  477.      if( rt < 0 )
  478.          {
  479.          STRPTR label;
  480.  
  481.          label = GetString( Gadgets[ GD_Label ] );
  482.  
  483.          if( label[0] )
  484.              strcpy( temp_gad->gi_Label, label );
  485.  
  486.          GT_GetGadgetAttrsA(Gadgets[ GD_Disabled ], Wnd, NULL,>Tags[0]);
  487.  
  488.          rcode = TRUE;  /*  VERY important !!!  */
  489.          }
  490. return rcode;
  491. }
  492.  
  493. BOOL MainVanillaKey( UBYTE code, struct Window *Wnd, struct Gadget *Gadgets[], struct IE_Data *IE )
  494. {
  495.     switch( code ) {
  496.         case 13:
  497.             return( -1 );
  498.             break;
  499.         case 27:
  500.             return( 1 );
  501.             break;
  502.     }
  503.  
  504.     return( 0 );
  505. }
  506.  
  507. BOOL OkKeyPressed( struct Window *Wnd, struct Gadget *Gadgets[], struct IE_Data *IE, struct IntuiMessage *Msg )
  508. {
  509.     return( -1 );
  510. }
  511.  
  512. BOOL CancKeyPressed( struct Window *Wnd, struct Gadget *Gadgets[], struct IE_Data *IE, struct IntuiMessage *Msg )
  513. {
  514.     return( 1 );
  515. }
  516.  
  517. BOOL OkClicked( struct Window *wnd, struct Gadget *Gadgets[], struct IE_Data *IE, struct IntuiMessage *Msg )
  518. {
  519.     return( -1 );
  520. }
  521.  
  522. BOOL CancClicked( struct Window *wnd, struct Gadget *Gadgets[], struct IE_Data *IE, struct IntuiMessage *Msg )
  523. {
  524.     return( 1 );
  525. }
  526.  
  527. BOOL LabelClicked( struct Window *wnd, struct Gadget *Gadgets[], struct IE_Data *IE, struct IntuiMessage *Msg )
  528. {
  529.     return( 0 );
  530. }
  531.  
  532. BOOL DisabledKeyPressed( struct Window *wnd, struct Gadget *Gadgets[], struct IE_Data *IE, struct IntuiMessage *Msg )
  533. {
  534.    return(0);
  535. }
  536.  
  537. BOOL DisabledClicked( struct Window *wnd, struct Gadget *Gadgets[], struct IE_Data *IE, struct IntuiMessage *Msg )
  538. {
  539.    return(0);
  540. }
  541.  
  542. ///
  543. /// IEX_Copy Doc
  544. /****** expander.library/IEX_Copy *******************************************
  545. *
  546. *   NAME
  547. *       IEX_Copy  -  Copy our objects
  548. *
  549. *   SYNOPSIS
  550. *       success = IEX_Copy( ID, IE_Data, offx, offy );
  551. *                           D0     A0     D1    D2
  552. *
  553. *       BOOL IEX_Copy( UWORD, struct IE_Data *, WORD, WORD );
  554. *
  555. *   FUNCTION
  556. *       IEditor calls this function when the user wants to copy
  557. *       some objects it doesn't know.
  558. *
  559. *   INPUTS
  560. *       ID          -   your ID
  561. *       IE_Data     -   information about IE
  562. *       offx, offy  -   offset of the copy
  563. *
  564. *   RESULT
  565. *       success     -   TRUE if succeeded, FALSE if there was no
  566. *                       enough memory
  567. *
  568. *   NOTES
  569. *
  570. *   BUGS
  571. *
  572. *   SEE ALSO
  573. *       IEditor/Expander.h
  574. *
  575. *****************************************************************************
  576. *
  577. */
  578. ///
  579. /// IEX_Copy
  580. __geta4 BOOL IEX_Copy( __D0 UWORD ID, __A0 struct IE_Data *IE, __D1 WORD offx, __D2 WORD offy )
  581. {
  582.     struct GFInfo   *getfile, *copy;
  583.  
  584.     for( getfile = IE->win_info->wi_Gadgets.mlh_Head; getfile->gi_Node.ln_Succ; getfile = getfile->gi_Node.ln_Succ ) {
  585.         if(( getfile->gi_Kind == ID ) && ( getfile->gi_Flags & G_ATTIVO )) {
  586.  
  587.             if( copy = AllocMem( sizeof( struct GFInfo ), 0L )) {
  588.  
  589.                 CopyMem((char *)getfile, (char *)copy, (long)sizeof( struct GFInfo ));
  590.  
  591.                 AddTail((struct List *)&IE->win_info->wi_Gadgets, (struct Node *)copy );
  592.  
  593.                 IE->win_info->wi_NumObjects += 1; /* Don't forget! */
  594.  
  595.                 copy->gi_Left += offx;  /* update its position */
  596.                 copy->gi_Top  += offy;
  597.  
  598.                 /* I don't want a neverending loop... ;-) */
  599.                 copy->gi_Flags &= ~G_ATTIVO;
  600.  
  601.             } else
  602.                 return( FALSE );
  603.         }
  604.     }
  605.  
  606.     return( TRUE );
  607. }
  608. ///
  609. /// IEX_Make Doc
  610. /****** expander.library/IEX_Make *******************************************
  611. *
  612. *   NAME
  613. *       IEX_Make  -  Put our objects on the window
  614. *
  615. *   SYNOPSIS
  616. *       next_gadget = IEX_Make( ID, IE_Data, GList );
  617. *                               D0     A0     A1
  618. *
  619. *       struct Gadget *IEX_Make( UWORD, struct IE_Data *, struct Gadget * );
  620. *
  621. *   FUNCTION
  622. *       IEditor calls this function before opening a window or after
  623. *       the user has selected 'Gadget/Tags...' and he has done some
  624. *       change.
  625. *
  626. *   INPUTS
  627. *       ID          -   your ID
  628. *       IE_Data     -   information about IE
  629. *       GList       -   gadget list to which append yours.
  630. *
  631. *   RESULT
  632. *       next_gadget -   a pointer to the last gadget you've created
  633. *                       or NULL for failure.
  634. *
  635. *   NOTES
  636. *       NOTE WELL: the window of your object could be closed when IE
  637. *                  calls this function!!!
  638. *
  639. *   BUGS
  640. *
  641. *   SEE ALSO
  642. *       IEditor/Expander.h, IEX_Refresh()
  643. *
  644. *****************************************************************************
  645. *
  646. */
  647. ///
  648. /// IEX_Make
  649. __geta4 struct Gadget *IEX_Make( __D0 UWORD ID, __A0 struct IE_Data *IE, __A1 struct Gadget *glist )
  650. {
  651.  struct NewGadget ng;
  652.  struct Gadget *my_gad;
  653.  
  654. /*The Single gad ;)*/
  655.  
  656.  ng.ng_TextAttr     = NULL;
  657.  ng.ng_VisualInfo   = IE->ScreenData->Visual;
  658.  ng.ng_Flags        = 0;
  659.  
  660.  ng.ng_LeftEdge     = 50;  /*Errr*/
  661.  ng.ng_Width        = 21;
  662.  ng.ng_Height       = 14;
  663.  ng.ng_GadgetText   = "";
  664.  ng.ng_TopEdge      = 20;  /*Errr*/
  665.  ng.ng_GadgetID     = 0;
  666.  
  667.  my_gad = glist= CreateGadgetA(GENERIC_KIND, glist, &ng,NULL);
  668.  
  669.  
  670. my_gad->Flags             |= GFLG_GADGIMAGE | GFLG_GADGHCOMP;
  671. my_gad->Activation        |= GACT_RELVERIFY;
  672. my_gad->GadgetRender       = (APTR)&GetFileImage;
  673. my_gad->SelectRender       = NULL;
  674.  
  675.     return( glist );
  676. }
  677. ///
  678. /// IEX_Free Doc
  679. /****** expander.library/IEX_Free *******************************************
  680. *
  681. *   NAME
  682. *       IEX_Free  -  Free all the unused memory when the window is closed
  683. *
  684. *   SYNOPSIS
  685. *       IEX_Free( ID, IE_Data );
  686. *                 D0     A0
  687. *
  688. *       void IEX_Free( UWORD, struct IE_Data * );
  689. *
  690. *   FUNCTION
  691. *       IEditor calls this function after closing a window.
  692. *       You must then release all the memory you can (e.g. when
  693. *       IE closes a window, it FreeGadgets() its GList).
  694. *
  695. *   INPUTS
  696. *       ID          -   your ID
  697. *       IE_Data     -   information about IE
  698. *
  699. *   RESULT
  700. *
  701. *   NOTES
  702. *
  703. *   BUGS
  704. *
  705. *   SEE ALSO
  706. *       IEditor/Expander.h
  707. *
  708. *****************************************************************************
  709. *
  710. */
  711. ///
  712. /// IEX_Free
  713. __geta4 void IEX_Free( __D0 UWORD ID, __A0 struct IE_Data *IE )
  714. {
  715.     /*  We've got nothing to free when the window is closed  */
  716. }
  717. ///
  718. /// IEX_Refresh Doc
  719. /****** expander.library/IEX_Refresh ****************************************
  720. *
  721. *   NAME
  722. *       IEX_Refresh  -  Refresh your objects
  723. *
  724. *   SYNOPSIS
  725. *       IEX_Refresh( ID, IE_Data );
  726. *                    D0     A0
  727. *
  728. *       void IEX_Refresh( UWORD, struct IE_Data * );
  729. *
  730. *   FUNCTION
  731. *       IEditor calls this function when the window needs refreshing.
  732. *       If your objects have some graphic element that can be corrupted,
  733. *       you must redrawn it, or refresh them in some way.
  734. *
  735. *   INPUTS
  736. *       ID          -   your ID
  737. *       IE_Data     -   information about IE
  738. *
  739. *   RESULT
  740. *
  741. *   NOTES
  742. *
  743. *   BUGS
  744. *
  745. *   SEE ALSO
  746. *       IEditor/Expander.h, IEX_Make()
  747. *
  748. *****************************************************************************
  749. *
  750. */
  751. ///
  752. /// IEX_Refresh
  753. __geta4 void IEX_Refresh( __D0 UWORD ID, __A0 struct IE_Data *IE )
  754. {
  755. }
  756. ///
  757.  
  758.  
  759. /*  I/O Functions               */
  760. /// IEX_Save Doc
  761. /****** expander.library/IEX_Save *******************************************
  762. *
  763. *   NAME
  764. *       IEX_Save  -  Save our objects in the file
  765. *
  766. *   SYNOPSIS
  767. *       IEX_Save( ID, IE_Data, File );
  768. *                 D0     A0     D1
  769. *
  770. *       void IEX_Save( UWORD, struct IE_Data *, BPTR );
  771. *
  772. *   FUNCTION
  773. *       IEditor calls this function only if we have some object
  774. *       in the GUI. We must then save in the provided file all
  775. *       the objects found in the win_info list that have the right ID .
  776. *
  777. *       We must also check the G_ATTIVO flag, since this function is
  778. *       called also when the user selects "Gadgets/Save..."
  779. *
  780. *   INPUTS
  781. *       ID          -   your ID
  782. *       IE_Data     -   information about IE
  783. *       File        -   BPTR of the file
  784. *
  785. *   RESULT
  786. *
  787. *   NOTES
  788. *
  789. *   BUGS
  790. *
  791. *   SEE ALSO
  792. *       IEditor/Expander.h, IEX_Load()
  793. *
  794. *****************************************************************************
  795. *
  796. */
  797. ///
  798. /// IEX_Save
  799. __geta4 void IEX_Save( __D0 UWORD ID, __A0 struct IE_Data *IE, __D1 BPTR File )
  800. {
  801.     struct GFInfo   *getfile;
  802.  
  803.     for( getfile = IE->win_info->wi_Gadgets.mlh_Head; getfile->gi_Node.ln_Succ; getfile = getfile->gi_Node.ln_Succ ) {
  804.         if(( getfile->gi_Kind == ID ) && ( getfile->gi_Flags & G_ATTIVO )) {
  805.             PutString( File, getfile->gi_Label );
  806.             FPutC(File,getfile->gi_disabled);
  807.         }
  808.     }
  809. }
  810. ///
  811. /// IEX_Load Doc
  812. /****** expander.library/IEX_Load *******************************************
  813. *
  814. *   NAME
  815. *       IEX_Load  -  Load our objects from the file
  816. *
  817. *   SYNOPSIS
  818. *       success = IEX_Load( ID, IE_Data, File, Num );
  819. *                           D0     A0     D1   D2
  820. *
  821. *       BOOL IEX_Load( UWORD, struct IE_Data *, BPTR, UWORD );
  822. *
  823. *   FUNCTION
  824. *       IEditor calls this function to load some object from a file.
  825. *
  826. *       We must then load <Num> objects and link them to the
  827. *       win_info's list.
  828. *
  829. *   INPUTS
  830. *       ID          -   your ID
  831. *       IE_Data     -   information about IE
  832. *       File        -   BPTR of the file
  833. *       Num         -   number of objects to load
  834. *
  835. *   RESULT
  836. *       success     -   TRUE for success, FALSE otherwise (= out of mem)
  837. *
  838. *   NOTES
  839. *
  840. *   BUGS
  841. *
  842. *   SEE ALSO
  843. *       IEditor/Expander.h, IEX_Save()
  844. *
  845. *****************************************************************************
  846. *
  847. */
  848. ///
  849. /// IEX_Load
  850. __geta4 BOOL IEX_Load( __D0 UWORD ID, __A0 struct IE_Data *IE, __D1 BPTR File, __D2 UWORD Num )
  851. {
  852.     struct GFInfo   *getfile;
  853.     UWORD               cnt;
  854.  
  855.     for( cnt = 0; cnt < Num; cnt++ ) {
  856.         if( getfile = AllocMem( sizeof( struct GFInfo ), MEMF_CLEAR )) {
  857.  
  858.             getfile->gi_Kind = ID;  /* VERY important!!! */
  859.  
  860.             AddTail(( struct List * )&IE->win_info->wi_Gadgets, ( struct Node * )getfile );
  861.  
  862.             FGetString( File, getfile->gi_Label );
  863.             (getfile->gi_disabled)=FGetC(File);
  864.  
  865.         } else
  866.             return( FALSE );
  867.     }
  868.  
  869.     return( TRUE );
  870. }
  871. ///
  872.  
  873.  
  874. /*  Source related functions    */
  875. /// IEX_StartSrcGen Doc
  876. /****** expander.library/IEX_StartSrcGen ************************************
  877. *
  878. *   NAME
  879. *       IEX_StartSrcgen  -  Are you ready to generate the source? ;-)
  880. *
  881. *   SYNOPSIS
  882. *       support_function = IEX_StartSrcGen( ID, IE_Data );
  883. *                                           D0     A0
  884. *
  885. *       STRPTR IEX_StartSrcGen( UWORD, struct IE_Data * );
  886. *
  887. *   FUNCTION
  888. *       IEditor calls this function just before generating the source.
  889. *       The expander should then walk through the window list, setting
  890. *       the right fields of the window info structures in order to
  891. *       let IE know what it need to put in the source.
  892. *
  893. *       Then, the expander must return a STRPTR to its support
  894. *       function(s), if any. They will be written in the source by IE,
  895. *       that will filter out any duplicate function.
  896. *
  897. *   INPUTS
  898. *       ID          -   your ID
  899. *       IE_Data     -   information about IE
  900. *
  901. *   RESULT
  902. *       support_function -  STRPTR to a support function(s) or NULL
  903. *
  904. *   NOTES
  905. *
  906. *   BUGS
  907. *
  908. *   SEE ALSO
  909. *       IEditor/Expander.h
  910. *
  911. *****************************************************************************
  912. *
  913. */
  914. ///
  915. /// IEX_StartSrcGen
  916. __geta4 STRPTR IEX_StartSrcGen( __D0 UWORD ID, __A0 struct IE_Data *IE )
  917. {
  918.     struct WindowInfo  *wnd;
  919.     struct GFInfo      *getfile;
  920.  
  921.     for( wnd = IE->win_list.mlh_Head; wnd->wi_succ; wnd = wnd->wi_succ ) {
  922.         if( wnd->wi_NumObjects ) {
  923.             for( getfile = wnd->wi_Gadgets.mlh_Head; getfile->gi_Node.ln_Succ; getfile = getfile->gi_Node.ln_Succ ) {
  924.                 if( getfile->gi_Kind == ID )
  925.                     wnd->wi_NeedRender = TRUE;
  926.             }
  927.         }
  928.     }
  929.  
  930.     return(( *IE->IEXFun->GetFirstLine )( Desc,"SUPPORT"));
  931. }
  932. ///
  933. /// IEX_WriteGlobals Doc
  934. /****** expander.library/IEX_WriteGlobals ***********************************
  935. *
  936. *   NAME
  937. *       IEX_WriteGlobals  -  Write your global variables
  938. *
  939. *   SYNOPSIS
  940. *       IEX_WriteGlobals( ID, GenFiles, IE_Data );
  941. *                         D0     A0        A1
  942. *
  943. *       void IEX_WriteGlobals( UWORD, struct GenFiles *, struct IE_Data * );
  944. *
  945. *   FUNCTION
  946. *       Write your global variables into the GenFiles->XDef file.
  947. *
  948. *   INPUTS
  949. *       ID          -   your ID
  950. *       GenFiles    -   file BPTRs
  951. *       IE_Data     -   information about IE
  952. *
  953. *   RESULT
  954. *
  955. *   NOTES
  956. *
  957. *   BUGS
  958. *
  959. *   SEE ALSO
  960. *       IEditor/Expander.h, IEditor/generatorlib.h
  961. *
  962. *****************************************************************************
  963. *
  964. */
  965. ///
  966. /// IEX_WriteGlobals
  967. __geta4 void IEX_WriteGlobals( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  968. {
  969. }
  970. ///
  971. /// IEX_WriteSetup Doc
  972. /****** expander.library/IEX_WriteSetup *************************************
  973. *
  974. *   NAME
  975. *       IEX_WriteSetup  -  Write your setup routine
  976. *
  977. *   SYNOPSIS
  978. *       IEX_WriteSetup( ID, GenFiles, IE_Data );
  979. *                       D0     A0        A1
  980. *
  981. *       void IEX_WriteSetup( UWORD, struct GenFiles *, struct IE_Data * );
  982. *
  983. *   FUNCTION
  984. *       This function is invoked in the SetupScreen routine, after
  985. *       the screen locking or opening and after the call to
  986. *       GetVisualInfo().
  987. *
  988. *       This can be useful if you need to alloc or do something
  989. *       just once before any window is opened.
  990. *
  991. *   INPUTS
  992. *       ID          -   your ID
  993. *       GenFiles    -   file BPTRs
  994. *       IE_Data     -   information about IE
  995. *
  996. *   RESULT
  997. *
  998. *   NOTES
  999. *
  1000. *   BUGS
  1001. *
  1002. *   SEE ALSO
  1003. *       IEditor/Expander.h, IEX_WriteCloseDown()
  1004. *
  1005. *****************************************************************************
  1006. *
  1007. */
  1008. ///
  1009. /// IEX_WriteSetup
  1010. __geta4 void IEX_WriteSetup( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  1011. {
  1012. }
  1013. ///
  1014. /// IEX_WriteCloseDown Doc
  1015. /****** expander.library/IEX_WriteCloseDown *********************************
  1016. *
  1017. *   NAME
  1018. *       IEX_WriteCloseDown
  1019. *
  1020. *   SYNOPSIS
  1021. *       IEX_WriteCloseDown( ID, GenFiles, IE_Data );
  1022. *                           D0     A0        A1
  1023. *
  1024. *       void IEX_WriteCloseDown( UWORD, struct GenFiles *, struct IE_Data * );
  1025. *
  1026. *   FUNCTION
  1027. *       This function is invoked in the CloseDown routine, before
  1028. *       the screen unlocking or closing.
  1029. *
  1030. *   INPUTS
  1031. *       ID          -   your ID
  1032. *       GenFiles    -   file BPTRs
  1033. *       IE_Data     -   information about IE
  1034. *
  1035. *   RESULT
  1036. *
  1037. *   NOTES
  1038. *
  1039. *   BUGS
  1040. *
  1041. *   SEE ALSO
  1042. *       IEditor/Expander.h, IEX_WriteSetup()
  1043. *
  1044. *****************************************************************************
  1045. *
  1046. */
  1047. ///
  1048. /// IEX_WriteCloseDown
  1049. __geta4 void IEX_WriteCloseDown( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  1050. {
  1051. }
  1052. ///
  1053. /// IEX_WriteHeaders Doc
  1054. /****** expander.library/IEX_WriteHeaders ***********************************
  1055. *
  1056. *   NAME
  1057. *       IEX_WriteHeaders  -  Write your headers
  1058. *
  1059. *   SYNOPSIS
  1060. *       IEX_WriteHeaders( ID, GenFiles, IE_Data );
  1061. *                         D0     A0        A1
  1062. *
  1063. *       void IEX_WriteHeaders( UWORD, struct GenFiles *, struct IE_Data * );
  1064. *
  1065. *   FUNCTION
  1066. *       Write your headers into the GenFiles->XDef file.
  1067. *
  1068. *   INPUTS
  1069. *       ID          -   your ID
  1070. *       GenFiles    -   file BPTRs
  1071. *       IE_Data     -   information about IE
  1072. *
  1073. *   RESULT
  1074. *
  1075. *   NOTES
  1076. *
  1077. *   BUGS
  1078. *
  1079. *   SEE ALSO
  1080. *       IEditor/Expander.h, IEditor/generatorlib.h
  1081. *
  1082. *****************************************************************************
  1083. *
  1084. */
  1085. ///
  1086. /// IEX_WriteHeaders
  1087. __geta4 void IEX_WriteHeaders( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  1088. {
  1089.     STRPTR string;
  1090.  
  1091.     if( string = ( *IE->IEXFun->GetFirstLine )( Desc, "HEADER" ))
  1092.         FPuts( Files->XDef, string );
  1093. }
  1094.  
  1095. ///
  1096. /// IEX_WriteRender Doc
  1097. /****** expander.library/IEX_WriteRender ************************************
  1098. *
  1099. *   NAME
  1100. *       IEX_WriteRender  -  Write your render routine
  1101. *
  1102. *   SYNOPSIS
  1103. *       IEX_WriteRender( ID, GenFiles, IE_Data );
  1104. *                        D0     A0        A1
  1105. *
  1106. *       void IEX_WriteRender( UWORD, struct GenFiles *, struct IE_Data * );
  1107. *
  1108. *   FUNCTION
  1109. *       This function is called by the generator in the <Wnd Label>Render
  1110. *       routine. If your object need some rendering instructions, then
  1111. *       you must write them into the source file.
  1112. *
  1113. *   INPUTS
  1114. *       ID          -   your ID
  1115. *       GenFiles    -   file BPTRs
  1116. *       IE_Data     -   information about IE
  1117. *
  1118. *   RESULT
  1119. *
  1120. *   NOTES
  1121. *
  1122. *   BUGS
  1123. *
  1124. *   SEE ALSO
  1125. *       IEditor/Expander.h, IEditor/generatorlib.h
  1126. *
  1127. *****************************************************************************
  1128. *
  1129. */
  1130. ///
  1131. /// IEX_WriteRender
  1132. __geta4 void IEX_WriteRender( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  1133. {
  1134. }
  1135. ///
  1136. /// IEX_GetIDCMP Doc
  1137. /****** expander.library/IEX_GetIDCMP ***************************************
  1138. *
  1139. *   NAME
  1140. *       IEX_GetIDCMP  -  Get the IDCMP you need
  1141. *
  1142. *   SYNOPSIS
  1143. *       IDCMP = IEX_GetIDCMP( ID, IDCMP, IE_Data );
  1144. *                             D0    D1      A0
  1145. *
  1146. *       ULONG IEX_GetIDCMP( UWORD, ULONG, struct IE_Data * );
  1147. *
  1148. *   FUNCTION
  1149. *       When called, this function must check if some objects fo your
  1150. *       kind are present in IE->win_info: if so, you should perform a
  1151. *       OR operation between the IDCMP passed by IE and the ones your
  1152. *       objects need to be fully functional.
  1153. *
  1154. *   INPUTS
  1155. *       ID          -   your ID
  1156. *       IDCMP       -   IDCMP of the window
  1157. *       IE_Data     -   information about IE
  1158. *
  1159. *   RESULT
  1160. *       IDCMP       -   new window IDCMPs
  1161. *
  1162. *   EXAMPLE
  1163. *       If your objects were Listviews, this is what your function should
  1164. *       look like:
  1165. *
  1166. *       ULONG IEX_GetIDCMP( __D0 UWORD ID, __D1 ULONG idcmp,
  1167. *                           __A0 struct IE_Data *IE )
  1168. *       {
  1169. *           struct MyObj    *obj;
  1170. *
  1171. *           for( obj = IE->win_info->wi_Gadgets.mlh_Head;
  1172. *                obj->Node.ln_Succ; obj = obj->Node.ln_Succ ) {
  1173. *
  1174. *               if( obj->Kind == ID )
  1175. *                   return( idcmp | LISTVIEWIDCMP );
  1176. *           }
  1177. *
  1178. *           return( idcmp );
  1179. *       }
  1180. *
  1181. *   NOTES
  1182. *       If your objects don't need any IDCMP, then you *must* return
  1183. *       the same IDCMP you received from IE.
  1184. *
  1185. *   BUGS
  1186. *
  1187. *   SEE ALSO
  1188. *       IEditor/Expander.h
  1189. *
  1190. *****************************************************************************
  1191. *
  1192. */
  1193. ///
  1194. /// IEX_GetIDCMP
  1195. __geta4 ULONG IEX_GetIDCMP( __D0 UWORD ID, __D1 ULONG idcmp, __A0 struct IE_Data *IE )
  1196. {
  1197.    struct GFInfo    *obj;
  1198.  
  1199.            for( obj = IE->win_info->wi_Gadgets.mlh_Head;
  1200.                 obj->gi_Node.ln_Succ; obj = obj->gi_Node.ln_Succ ) {
  1201.  
  1202.                if( obj->gi_Kind == ID )
  1203.                    return( idcmp | BUTTONIDCMP );
  1204.            }
  1205.  
  1206.    return( idcmp );
  1207. }
  1208. ///
  1209. /// IEX_WriteData Doc
  1210. /****** expander.library/IEX_WriteData **************************************
  1211. *
  1212. *   NAME
  1213. *       IEX_WriteData  -  Write your data
  1214. *
  1215. *   SYNOPSIS
  1216. *       IEX_WriteData( ID, GenFiles, IE_Data );
  1217. *                      D0     A0        A1
  1218. *
  1219. *       void IEX_WriteData( UWORD, struct GenFiles *, struct IE_Data * );
  1220. *
  1221. *   FUNCTION
  1222. *       Write your objects' data into the file.
  1223. *
  1224. *   INPUTS
  1225. *       ID          -   your ID
  1226. *       GenFiles    -   file BPTRs
  1227. *       IE_Data     -   information about IE
  1228. *
  1229. *   RESULT
  1230. *
  1231. *   NOTES
  1232. *
  1233. *   BUGS
  1234. *
  1235. *   SEE ALSO
  1236. *       IEditor/Expander.h, IEditor/generatorlib.h
  1237. *
  1238. *****************************************************************************
  1239. *
  1240. */
  1241. ///
  1242. /// IEX_WriteData
  1243. __geta4 void IEX_WriteData( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  1244. {
  1245. UBYTE               X[6], Y[6];
  1246.     struct Descriptor   Dsc[] = {
  1247.         { 'o', NULL },
  1248.         { 'x', X },
  1249.         { 'y', Y },
  1250.         { 'i',7 },     /*Errr*/
  1251.         { 0, NULL }
  1252.     };
  1253.     struct GFInfo   *getfile;
  1254.     struct WindowInfo  *wnd;
  1255.     STRPTR              Xdef, Data;
  1256.     static UBYTE        ld[] = "%ld";
  1257.  
  1258.     Xdef = ( *IE->IEXFun->GetFirstLine )( Desc, "EXTERN" );
  1259.     Data = ( *IE->IEXFun->GetFirstLine )( Desc, "DATA" );
  1260.  
  1261.     for( wnd = IE->win_list.mlh_Head; wnd->wi_succ; wnd = wnd->wi_succ ) {
  1262.         if( wnd->wi_NumObjects ) {
  1263.             for( getfile = wnd->wi_Gadgets.mlh_Head; getfile->gi_Node.ln_Succ; getfile = getfile->gi_Node.ln_Succ ) {
  1264.                 if( getfile->gi_Kind == ID ) {
  1265.  
  1266.                     Dsc[0].Meaning = getfile->gi_Label;
  1267.  
  1268.                     if( Xdef )
  1269.                         ( *IE->IEXFun->WriteFormatted )( Files->XDef, Xdef, &Dsc[0] );
  1270.  
  1271.                     sprintf( X, ld, getfile->gi_Left - IE->ScreenData->XOffset );
  1272.                     sprintf( Y, ld, getfile->gi_Top  - IE->ScreenData->YOffset );
  1273.  
  1274.                     if( Data )
  1275.                         ( *IE->IEXFun->WriteFormatted )( Files->Std, Data, &Dsc[0] );
  1276.                 }
  1277.             }
  1278.         }
  1279.     }
  1280. }
  1281. ///
  1282. /// IEX_WriteChipData Doc
  1283. /****** expander.library/IEX_WriteChipData **********************************
  1284. *
  1285. *   NAME
  1286. *       IEX_WriteChipData  -  Write your chip data
  1287. *
  1288. *   SYNOPSIS
  1289. *       IEX_WriteChipData( ID, GenFiles, IE_Data );
  1290. *                          D0     A0        A1
  1291. *
  1292. *       void IEX_WriteChipData( UWORD, struct GenFiles *, struct IE_Data * );
  1293. *
  1294. *   FUNCTION
  1295. *       Write your objects' chip data into the file.
  1296. *
  1297. *   INPUTS
  1298. *       ID          -   your ID
  1299. *       GenFiles    -   file BPTRs
  1300. *       IE_Data     -   information about IE
  1301. *
  1302. *   RESULT
  1303. *
  1304. *   NOTES
  1305. *
  1306. *   BUGS
  1307. *
  1308. *   SEE ALSO
  1309. *       IEditor/Expander.h, IEditor/generatorlib.h
  1310. *
  1311. *****************************************************************************
  1312. *
  1313. */
  1314. ///
  1315. /// IEX_WriteChipData
  1316. __geta4 void IEX_WriteChipData( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  1317. {
  1318.  STRPTR string;
  1319.  
  1320.     if( string = ( *IE->IEXFun->GetFirstLine )( Desc, "CHIP" ))
  1321.         FPuts( Files->XDef, string );
  1322. }
  1323. ///
  1324. /// IEX_WriteOpenWnd Doc
  1325. /****** expander.library/IEX_WriteOpenWnd ***********************************
  1326. *
  1327. *   NAME
  1328. *       IEX_WriteOpenWnd  -  Write your open wnd code
  1329. *
  1330. *   SYNOPSIS
  1331. *       IEX_WriteOpenWnd( ID, GenFiles, IE_Data );
  1332. *                         D0     A0        A1
  1333. *
  1334. *       void IEX_WriteOpenWnd( UWORD, struct GenFiles *, struct IE_Data * );
  1335. *
  1336. *   FUNCTION
  1337. *       This function is called inside every Open<Wnd Label>Window routine,
  1338. *       just before opening the window. You can use it to write some code
  1339. *       needed by your objects that must be executed at that time.
  1340. *
  1341. *   INPUTS
  1342. *       ID          -   your ID
  1343. *       GenFiles    -   file BPTRs
  1344. *       IE_Data     -   information about IE
  1345. *
  1346. *   RESULT
  1347. *
  1348. *   NOTES
  1349. *
  1350. *   BUGS
  1351. *
  1352. *   SEE ALSO
  1353. *       IEditor/Expander.h, IEditor/generatorlib.h
  1354. *
  1355. *****************************************************************************
  1356. *
  1357. */
  1358. ///
  1359. /// IEX_WriteOpenWnd
  1360. __geta4 void IEX_WriteOpenWnd( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  1361. {
  1362.   struct Descriptor   Dsc[] = {
  1363.         { 'o', NULL },
  1364.         { 0, NULL }
  1365.     };
  1366.     struct GFInfo       *getfile;
  1367.     STRPTR              String;
  1368.  
  1369.     if(( IE->win_info->wi_NumObjects ) && ( String = ( *IE->IEXFun->GetFirstLine )( Desc, "OPENWND" ))) {
  1370.         for( getfile = IE->win_info->wi_Gadgets.mlh_Head; getfile->gi_Node.ln_Succ; getfile = getfile->gi_Node.ln_Succ ) {
  1371.             if( getfile->gi_Kind == ID ) {
  1372.  
  1373.                 Dsc[0].Meaning = getfile->gi_Label;
  1374.  
  1375.                 ( *IE->IEXFun->WriteFormatted )( Files->Std, String, &Dsc[0] );
  1376.             }
  1377.         }
  1378.     }
  1379. }
  1380. ///
  1381. /// IEX_WriteCloseWnd Doc
  1382. /****** expander.library/IEX_WriteCloseWnd ***********************************
  1383. *
  1384. *   NAME
  1385. *       IEX_WriteCloseWnd  -  Write your close wnd code
  1386. *
  1387. *   SYNOPSIS
  1388. *       IEX_WriteCloseWnd( ID, GenFiles, IE_Data );
  1389. *                         D0     A0        A1
  1390. *
  1391. *       void IEX_WriteCloseWnd( UWORD, struct GenFiles *, struct IE_Data * );
  1392. *
  1393. *   FUNCTION
  1394. *       This function is called inside every Close<Wnd Label>Window routine,
  1395. *       just before closing the window. You can use it to write some code
  1396. *       needed by your objects that must be executed at that time.
  1397. *
  1398. *   INPUTS
  1399. *       ID          -   your ID
  1400. *       GenFiles    -   file BPTRs
  1401. *       IE_Data     -   information about IE
  1402. *
  1403. *   RESULT
  1404. *
  1405. *   NOTES
  1406. *
  1407. *   BUGS
  1408. *
  1409. *   SEE ALSO
  1410. *       IEditor/Expander.h, IEditor/generatorlib.h
  1411. *
  1412. *****************************************************************************
  1413. *
  1414. */
  1415. ///
  1416. /// IEX_WriteCloseWnd
  1417. __geta4 void IEX_WriteCloseWnd( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  1418. {
  1419. }
  1420. ///
  1421.